package com.hwc.demo.dubbo;

import java.io.IOException;
import java.util.List;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.hwc.demo.dubbo.bean.UserAddress;
import com.hwc.demo.dubbo.service.UserService;

public class OrderConsumerMainRunner {
	public static void main(String[] args) throws IOException {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("consumer.xml");
		context.start();

		// 像使用本地bean一样使用远程bean
		UserService userService = (UserService) context.getBean("userService");

		// 远程调用
		List<UserAddress> address_list = userService.getUserAddressList(2);

		address_list.forEach(o -> System.out.println(o));
		
		//阻塞
		System.in.read(); // 按任意键退出
	}
}
